package com.autotest.sync;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

import java.awt.BorderLayout;

import javax.swing.JTextArea;

import com.autotest.sync.TopPanel.ClearEvent;
import com.autotest.sync.utils.MyPrintStream;

import java.awt.Color;

/**
 * 输出展示
 * @author zy
 *
 */
public class BottomPanel extends JPanel implements ClearEvent {
	private static final long serialVersionUID = 964495379418610206L;
	private JTextArea textArea;
	/**
	 * Create the panel.
	 */
	public BottomPanel() {
		setLayout(new BorderLayout(0, 0));
		
		textArea = new JTextArea();
		textArea.setBackground(Color.GRAY);
		textArea.setLineWrap(true);        //激活自动换行功能 
		textArea.setWrapStyleWord(true); // 激活断行不断字功能
		textArea.setEditable(false);
		JScrollPane jspane = new JScrollPane(textArea);
		this.add(jspane);
		add(jspane, BorderLayout.CENTER);
		MyPrintStream out = new MyPrintStream(System.out, textArea);
		System.setOut(out);
		System.setErr(out);
	}
	@Override
	public void clear() {
		textArea.setText("");
		
	}

}
